#include "ScoreScreen.h"
#include "SDL_ttf.h"
#include "defines.h"
#include <string>
#include <sstream>
using namespace std;

ScoreScreen::ScoreScreen(Paddle *p1, Paddle *p2)
{
	this->p1 = p1;
	this->p2 = p2;
	TTF_Init();
	//Open the font 
	font = TTF_OpenFont( "lazy.ttf", 28 );
	textColor.r = 255;
	textColor.g = 255;
	textColor.b = 255;
}

void ScoreScreen::draw(SDL_Surface *display)
{
	string p1Score = intToString(p1->score);
	string p2Score = intToString(p2->score);
	const char *mp = p1Score.c_str();
	SDL_Surface *message = TTF_RenderText_Solid( font, mp, textColor );
	mp = p2Score.c_str();
	SDL_Surface *message2 = TTF_RenderText_Solid( font, mp, textColor );
	//Draw the paddle scores
	CSurface::OnDraw(display, message, 10, 10);
	CSurface::OnDraw(display, message2, 500, 10);
}

ScoreScreen::~ScoreScreen(void)
{
}


